package com.ysh.gsm;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * @author ysh
 *
 */
@IdClass(CdrPK.class)
@Entity()
@Table(name = "cdr_mr")
@NamedQueries( {
	@NamedQuery(name = "cmr.findByCall", query = "Select cm from CdrMR cm LEFT JOIN cm.callLeg cal where cal.call=:call ORDER BY cm.startTime"),
	@NamedQuery(name = "cmr.findByCell", query = "Select cm from CdrMR cm where cm.cellId= :cellId ORDER BY cm.actTa")
})

public class CdrMR implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3844046249433973355L;
	private Callleg callLeg;
	private short sequence;
	private byte cellId;
	private int probeId;	
	private int startTime;
	private short startTimeExt;
	private TimeDimension timeDimension;
	private byte rxlevFull;
	private byte rxlevSub;
	private byte rxqualFull;
	private byte rxqualSub;
	private byte upextrxlevFull;
	private byte upextrxlevSub;
	private byte bsPowerLev;
	private byte msPowerLev;
	private byte actTa;
	private byte baUsed;
	private byte dtxUsed;
	private byte serCellRxlevFull;
	private byte serCellRxlevSub;
	private byte baUsed3G;	
	private byte measValid;
	private byte serCellRxqualFull;
	private byte serCellRxqualSub;	
	private byte ncell1Rxlev;
	private byte ncell1BcchFreq;
	private byte ncell1Bsic;	
	private byte ncell2Rxlev;
	private byte ncell2BcchFreq;
	private byte ncell2Bsic;
	private byte ncell3Rxlev;
	private byte ncell3BcchFreq;
	private byte ncell3Bsic;
	private byte ncell4Rxlev;
	private byte ncell4BcchFreq;
	private byte ncell4Bsic;
	private byte ncell5Rxlev;
	private byte ncell5BcchFreq;
	private byte ncell5Bsic;	
	private byte ncell6Rxlev;
	private byte ncell6BcchFreq;
	private byte ncell6Bsic;	
	private short msTimingOffset;

	private  transient Date start;
	@Transient
	public Date getStart() {
		return new Date(startTime*1000L);
	}
	public void setStart(Date start) {
		this.start = start;
	}
	@Id
	public Callleg getCallLeg() {
		return callLeg;
	}
	@Id
	public short getSequence() {
		return sequence;
	}
	@Column(name = "cell_id", nullable = false)
	public byte getCellId() {
		return cellId;
	}
	@Column(name = "probe_key", nullable = false)
	public int getProbeId() {
		return probeId;
	}
	@Column(name = "start_time", nullable = false)
	public int getStartTime() {
		return startTime;
	}
	@Column(name = "start_time_ext" , nullable = false)
	public short getStartTimeExt() {
		return startTimeExt;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "time_key", referencedColumnName = "time_key",nullable = false)
	public TimeDimension getTimeDimension() {
		return timeDimension;
	}
	@Column(name = "rxlevfull")
	public byte getRxlevFull() {
		return rxlevFull;
	}
	@Column(name = "rxlevsub")
	public byte getRxlevSub() {
		return rxlevSub;
	}
	@Column(name = "rxqual_full")
	public byte getRxqualFull() {
		return rxqualFull;
	}
	@Column(name = "rxqual_sub")
	public byte getRxqualSub() {
		return rxqualSub;
	}
	@Column(name = "upextrxlev_full")
	public byte getUpextrxlevFull() {
		return upextrxlevFull;
	}
	@Column(name = "upextrxlev_sub")
	public byte getUpextrxlevSub() {
		return upextrxlevSub;
	}
	@Column(name = "bs_power_lev")
	public byte getBsPowerLev() {
		return bsPowerLev;
	}
	@Column(name = "ms_power_lev")
	public byte getMsPowerLev() {
		return msPowerLev;
	}
	@Column(name = "act_ta")
	public byte getActTa() {
		return actTa;
	}
	@Column(name = "ba_used")
	public byte getBaUsed() {
		return baUsed;
	}
	@Column(name = "dtx_used")
	public byte getDtxUsed() {
		return dtxUsed;
	}
	@Column(name = "serv_cell_rxlev_full")
	public byte getSerCellRxlevFull() {
		return serCellRxlevFull;
	}
	@Column(name = "serv_cell_rxlev_sub")
	public byte getSerCellRxlevSub() {
		return serCellRxlevSub;
	}
	@Column(name = "ba_used_3g")
	public byte getBaUsed3G() {
		return baUsed3G;
	}
	@Column(name = "meas_valid")
	public byte getMeasValid() {
		return measValid;
	}
	@Column(name = "serv_cell_rxqual_full")
	public byte getSerCellRxqualFull() {
		return serCellRxqualFull;
	}
	@Column(name = "serv_cell_rxqual_sub")
	public byte getSerCellRxqualSub() {
		return serCellRxqualSub;
	}
	@Column(name = "ncell1_rxlev")
	public byte getNcell1Rxlev() {
		return ncell1Rxlev;
	}
	@Column(name = "ncell1_bcch_freq")
	public byte getNcell1BcchFreq() {
		return ncell1BcchFreq;
	}
	@Column(name = "ncell1_bsic")
	public byte getNcell1Bsic() {
		return ncell1Bsic;
	}
	@Column(name = "ncell2_rxlev")
	public byte getNcell2Rxlev() {
		return ncell2Rxlev;
	}
	@Column(name = "ncell2_bcch_freq")
	public byte getNcell2BcchFreq() {
		return ncell2BcchFreq;
	}
	@Column(name = "ncell2_bsic")
	public byte getNcell2Bsic() {
		return ncell2Bsic;
	}
	@Column(name = "ncell3_rxlev")
	public byte getNcell3Rxlev() {
		return ncell3Rxlev;
	}
	@Column(name = "ncell3_bcch_freq")
	public byte getNcell3BcchFreq() {
		return ncell3BcchFreq;
	}
	@Column(name = "ncell3_bsic")
	public byte getNcell3Bsic() {
		return ncell3Bsic;
	}
	@Column(name = "ncell4_rxlev")
	public byte getNcell4Rxlev() {
		return ncell4Rxlev;
	}
	@Column(name = "ncell4_bcch_freq")
	public byte getNcell4BcchFreq() {
		return ncell4BcchFreq;
	}
	@Column(name = "ncell4_bsic")
	public byte getNcell4Bsic() {
		return ncell4Bsic;
	}
	@Column(name = "ncell5_rxlev")
	public byte getNcell5Rxlev() {
		return ncell5Rxlev;
	}
	@Column(name = "ncell5_bcch_freq")
	public byte getNcell5BcchFreq() {
		return ncell5BcchFreq;
	}
	@Column(name = "ncell5_bsic")
	public byte getNcell5Bsic() {
		return ncell5Bsic;
	}
	@Column(name = "ncell6_rxlev")
	public byte getNcell6Rxlev() {
		return ncell6Rxlev;
	}
	@Column(name = "ncell6_bcch_freq")
	public byte getNcell6BcchFreq() {
		return ncell6BcchFreq;
	}
	@Column(name = "ncell6_bsic")
	public byte getNcell6Bsic() {
		return ncell6Bsic;
	}
	@Column(name = "ms_timing_offset")
	public short getMsTimingOffset() {
		return msTimingOffset;
	}
	public void setCallLeg(Callleg callLeg) {
		this.callLeg = callLeg;
	}
	public void setSequence(short sequence) {
		this.sequence = sequence;
	}
	public void setCellId(byte cellId) {
		this.cellId = cellId;
	}
	public void setProbeId(int probeId) {
		this.probeId = probeId;
	}
	public void setStartTime(int startTime) {
		this.startTime = startTime;
	}
	public void setStartTimeExt(short startTimeExt) {
		this.startTimeExt = startTimeExt;
	}

	public void setTimeDimension(TimeDimension timeDimension) {
		this.timeDimension = timeDimension;
	}
	public void setRxlevFull(byte rxlevFull) {
		this.rxlevFull = rxlevFull;
	}
	public void setRxlevSub(byte rxlevSub) {
		this.rxlevSub = rxlevSub;
	}
	public void setRxqualFull(byte rxqualFull) {
		this.rxqualFull = rxqualFull;
	}
	public void setRxqualSub(byte rxqualSub) {
		this.rxqualSub = rxqualSub;
	}
	public void setUpextrxlevFull(byte upextrxlevFull) {
		this.upextrxlevFull = upextrxlevFull;
	}
	public void setUpextrxlevSub(byte upextrxlevSub) {
		this.upextrxlevSub = upextrxlevSub;
	}
	public void setBsPowerLev(byte bsPowerLev) {
		this.bsPowerLev = bsPowerLev;
	}
	public void setMsPowerLev(byte msPowerLev) {
		this.msPowerLev = msPowerLev;
	}
	public void setActTa(byte actTa) {
		this.actTa = actTa;
	}
	public void setBaUsed(byte baUsed) {
		this.baUsed = baUsed;
	}
	public void setDtxUsed(byte dtxUsed) {
		this.dtxUsed = dtxUsed;
	}
	public void setSerCellRxlevFull(byte serCellRxlevFull) {
		this.serCellRxlevFull = serCellRxlevFull;
	}
	public void setSerCellRxlevSub(byte serCellRxlevSub) {
		this.serCellRxlevSub = serCellRxlevSub;
	}
	public void setBaUsed3G(byte baUsed3G) {
		this.baUsed3G = baUsed3G;
	}
	public void setMeasValid(byte measValid) {
		this.measValid = measValid;
	}
	public void setSerCellRxqualFull(byte serCellRxqualFull) {
		this.serCellRxqualFull = serCellRxqualFull;
	}
	public void setSerCellRxqualSub(byte serCellRxqualSub) {
		this.serCellRxqualSub = serCellRxqualSub;
	}
	public void setNcell1Rxlev(byte ncell1Rxlev) {
		this.ncell1Rxlev = ncell1Rxlev;
	}
	public void setNcell1BcchFreq(byte ncell1BcchFreq) {
		this.ncell1BcchFreq = ncell1BcchFreq;
	}
	public void setNcell1Bsic(byte ncell1Bsic) {
		this.ncell1Bsic = ncell1Bsic;
	}
	public void setNcell2Rxlev(byte ncell2Rxlev) {
		this.ncell2Rxlev = ncell2Rxlev;
	}
	public void setNcell2BcchFreq(byte ncell2BcchFreq) {
		this.ncell2BcchFreq = ncell2BcchFreq;
	}
	public void setNcell2Bsic(byte ncell2Bsic) {
		this.ncell2Bsic = ncell2Bsic;
	}
	public void setNcell3Rxlev(byte ncell3Rxlev) {
		this.ncell3Rxlev = ncell3Rxlev;
	}
	public void setNcell3BcchFreq(byte ncell3BcchFreq) {
		this.ncell3BcchFreq = ncell3BcchFreq;
	}
	public void setNcell3Bsic(byte ncell3Bsic) {
		this.ncell3Bsic = ncell3Bsic;
	}
	public void setNcell4Rxlev(byte ncell4Rxlev) {
		this.ncell4Rxlev = ncell4Rxlev;
	}
	public void setNcell4BcchFreq(byte ncell4BcchFreq) {
		this.ncell4BcchFreq = ncell4BcchFreq;
	}
	public void setNcell4Bsic(byte ncell4Bsic) {
		this.ncell4Bsic = ncell4Bsic;
	}
	public void setNcell5Rxlev(byte ncell5Rxlev) {
		this.ncell5Rxlev = ncell5Rxlev;
	}
	public void setNcell5BcchFreq(byte ncell5BcchFreq) {
		this.ncell5BcchFreq = ncell5BcchFreq;
	}
	public void setNcell5Bsic(byte ncell5Bsic) {
		this.ncell5Bsic = ncell5Bsic;
	}
	public void setNcell6Rxlev(byte ncell6Rxlev) {
		this.ncell6Rxlev = ncell6Rxlev;
	}
	public void setNcell6BcchFreq(byte ncell6BcchFreq) {
		this.ncell6BcchFreq = ncell6BcchFreq;
	}
	public void setNcell6Bsic(byte ncell6Bsic) {
		this.ncell6Bsic = ncell6Bsic;
	}
	public void setMsTimingOffset(short msTimingOffset) {
		this.msTimingOffset = msTimingOffset;
	}
	
	
	

}
